//
//  GRXBuyCollectionViewCell.m
//  1-MushroomStreet-自定义tabbar
//
//  Created by xmg on 15/12/23.
//  Copyright © 2015年 grx. All rights reserved.
//

#import "GRXBuyCollectionViewCell.h"
#import "GRXBuyItem.h"
#import <UIImageView+WebCache.h>
@interface GRXBuyCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIButton *titleButton;
@property (weak, nonatomic) IBOutlet UIView *bottomView;

@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;


@end

@implementation GRXBuyCollectionViewCell


- (void)setItem:(GRXBuyItem *)item{
    _item = item;
    
    [self.titleButton setTitle:item.name forState:UIControlStateNormal];
    self.titleLabel.text = item.title;
    self.descLabel.text = item.desc;
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:item.img]];
    
    if (item.icon.length != 0 && self.titleButton.state == UIControlStateNormal ) {
        [self.titleButton.imageView sd_setImageWithURL:[NSURL URLWithString:item.icon]];
    }
}


- (void)awakeFromNib{
    
    [self.titleButton setBackgroundColor:kGRXColor(240, 240, 240)];
    
    self.titleButton.layer.cornerRadius = self.titleButton.height * 0.5;
    
    self.bottomView.backgroundColor = karcRandomColor;
}

@end
